﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace autoBidProject
{
    class Match
    {
        private string home, away;

        private List<Event> events;

        internal List<Event> Events
        {
            get { return events; }
            set { events = value; }
        }

        public void Add(Event _event)
        {
            events.Add(_event);
        }

        public List<Event> GetEvents()
        {
            return new List<Event>();
        }

        public Match(string home, string away)
        {
            this.home = home;
            this.away = away;
            this.events = new List<Event>();
        }

        public string Name()
        {
            return home + " - " + away;
        }

        public bool Same(Match anotherMatch)
        {
            if (this.home.IndexOf(anotherMatch.home) != -1 || anotherMatch.home.IndexOf(this.home) != -1)
                return true;

            if (this.away.IndexOf(anotherMatch.away) != -1 || anotherMatch.away.IndexOf(this.away) != -1)
                return true;

            return false;
        }

        public Event GetEvent(bool b_FullTime ,string hdp)
        {
            foreach(Event e in events)
                if(b_FullTime)
                {
                    if (e.ft_hdp == hdp)
                        return e;
                }
                else
                    if (e.fh_hdp == hdp)
                        return e;
            return null;
        }
    }
}
